#ifndef PLAYSCENE_H
#define PLAYSCENE_H

#include <QMainWindow>
#include<QTimer>
#include"hero.h"
#include"map.h"
#include"obstacles.h"
#include<vector>
#include"bomb.h"


class playscene : public QMainWindow
{
    Q_OBJECT
public:
    explicit playscene(QWidget *parent = nullptr);

    void initScene();

    //更新各元素坐标
    void updatePostion();

    void paintEvent(QPaintEvent*);

    void keyPressEvent(QKeyEvent *);

    //地图对象
    Map map;

    //直升机对象
    hero heli=hero(":/res/heli2.png");

    //左右偏移量
    int x_offset=3;

    //定时器
    QTimer m_timer;
    QTimer h_timer;


    //障碍物
    obstacles obj[10]={obstacles(1),obstacles(1),obstacles(2),obstacles(3),obstacles(3),obstacles(4),obstacles(4),obstacles(5),obstacles(5),obstacles(6)};

    int recoder=0;
    void objcome();

    //碰撞检测
    void collisionDetec();
    bomb bombs[10];


    int life=3;

    bool isRun=true;


signals:
    //返回信号
    void chooseBack();

    //游戏结束
    void gameover();

};

#endif // PLAYSCENE_H
